import { tranListToTreeData, getAgencyIds } from "@/utils/agency";
const agencys = {
  state: {
    agencytree: [],
    agencystring: "",
    agencylist: [],
  },

  mutations: {
    SET_AGENCYTREE: (state, data) => {
      state.agencytree = tranListToTreeData(data, 0);
    },
    //commit参数只能接收一个，用对象包裹
    SET_AGENCYSTRING: (state, {data, agencyId}) => {
      console.log(data);
      //console.log(data,agencyId);
      state.agencystring = getAgencyIds(data, +agencyId);
    },
    SET_AGENCYLIST: (state, data) => {
      state.agencylist = data;
    },
  },
};

export default agencys;
